﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Microsoft.ProductivityHub.SilverlightBookshelf
{
    public class BindableValues
    {
        private static Color _buttonFaceColor = Colors.White;
        private static Color _linkColor = Color.FromArgb(
            255,
            System.Convert.ToByte("00", 16),
            System.Convert.ToByte("66", 16),
            System.Convert.ToByte("CC", 16));


        /// <Color x:Key="ButtonBackDarkColor">#F57017</Color>
        private static Color _buttonBackDarkColor = Color.FromArgb(
            255,
            System.Convert.ToByte("F5", 16),
            System.Convert.ToByte("70", 16),
            System.Convert.ToByte("17", 16));

        /// <Color x:Key="ButtonBackLightColor">#FED034</Color>
        private static Color _buttonBackLightColor = Color.FromArgb(
            255,
            System.Convert.ToByte("FE", 16),
            System.Convert.ToByte("D0", 16),
            System.Convert.ToByte("34", 16));

        private static LinearGradientBrush _buttonGradientBrush = null;
        private static LinearGradientBrush _contentGradientBrush = null;
        private static LinearGradientBrush _ratingGradientBrush = null;

        /// <Color x:Key="ButtonBackLightColor">#FFFFFFFF</Color>
        private static Color _contentLightColor = Colors.White;
        
        /// <Color x:Key="ButtonBackLightColor">#FFF1F1F1</Color>
        private static Color _contentDarkColor = Color.FromArgb(
            255,
            System.Convert.ToByte("F1", 16),
            System.Convert.ToByte("F1", 16),
            System.Convert.ToByte("F1", 16));


        private static SolidColorBrush _buttonFaceBrush = null;
        private static SolidColorBrush _linkColorBrush = null;
        private static SolidColorBrush _lightColorBrush = null;
        private static SolidColorBrush _darkColorBrush = null;

        public static Color HubButtonFace
        {
            get { return _buttonFaceColor; }
            set { _buttonFaceColor = value; }
        }

        public static Color LinkColor
        {
            get { return _linkColor; }
            set { _linkColor = value; }
        }

        public static Color ButtonBackDarkColor
        {
            get { return _buttonBackDarkColor; }
            set { _buttonBackDarkColor = value; }

        }

        public static Color ButtonBackLightColor
        {
            get { return _buttonBackLightColor; }
            set { _buttonBackLightColor = value; }

        }

        public static SolidColorBrush LinkColorBrush
        {
            get
            {
                if (_linkColorBrush == null)
                {
                    _linkColorBrush = new SolidColorBrush(LinkColor);
                }
                return _linkColorBrush;
            }
            set
            {
                _linkColorBrush = value;
            }

        }

        public static SolidColorBrush ButtonFaceBrush
        {
            get
            {
                if (_buttonFaceBrush == null)
                {
                    _buttonFaceBrush = new SolidColorBrush(HubButtonFace);
                }
                return _buttonFaceBrush;
            }
            set
            {
                _buttonFaceBrush = value;
            }

        }

        public static SolidColorBrush DarkColorBrush
        {
            get
            {
                if (_darkColorBrush == null)
                {
                    _darkColorBrush = new SolidColorBrush(ButtonBackDarkColor);
                }
                return _darkColorBrush;
            }
            set
            {
                _darkColorBrush = value;
            }

        }

        public static SolidColorBrush LightColorBrush
        {
            get
            {
                if (_lightColorBrush == null)
                {
                    _lightColorBrush = new SolidColorBrush(ButtonBackLightColor);
                }
                return _lightColorBrush;

            }
            set
            {
                _lightColorBrush = value;
            }

        }

        public static LinearGradientBrush RatingGradientBrush
        {
            get
            {
                if (_ratingGradientBrush == null)
                {
                    GradientStop stop1 = new GradientStop();
                    stop1.Color = Color.FromArgb(
                        255,
                        System.Convert.ToByte("D1", 16),
                        System.Convert.ToByte("D1", 16),
                        System.Convert.ToByte("D1", 16));
                    stop1.Offset = 0.0;

                    GradientStop stop2 = new GradientStop();
                    stop2.Color = _linkColor;
                    stop2.Offset = 1.0;

                    GradientStopCollection gsc = new GradientStopCollection();
                    gsc.Add(stop1);
                    gsc.Add(stop2);

                    _ratingGradientBrush = new LinearGradientBrush(gsc, 90.0);
                    _ratingGradientBrush.EndPoint = new Point(0.5, 1);
                    _ratingGradientBrush.StartPoint = new Point(0.5, 0);

                }

                return _ratingGradientBrush;

            }
            set
            {
                _ratingGradientBrush = value;
            }

        }
        public static LinearGradientBrush ContentGradientBrush
        {
            get
            {
                if (_contentGradientBrush == null)
                {
                    GradientStop stop1 = new GradientStop();
                    stop1.Color = _contentLightColor;
                    stop1.Offset = 0.0;

                    GradientStop stop2 = new GradientStop();
                    stop2.Color = _contentDarkColor;
                    stop2.Offset = 1.0;

                    GradientStopCollection gsc = new GradientStopCollection();
                    gsc.Add(stop1);
                    gsc.Add(stop2);

                    _contentGradientBrush = new LinearGradientBrush(gsc, 90.0);
                    _contentGradientBrush.EndPoint = new Point(0.5, 1);
                    _contentGradientBrush.StartPoint = new Point(0.5, 0);

                }

                return _contentGradientBrush;

            }
            set
            {
                _contentGradientBrush = value;
            }

        }

        public static LinearGradientBrush ButtonGradientBrush
        {
            get
            {
                if (_buttonGradientBrush == null)
                {
                    GradientStop stop1 = new GradientStop();
                    stop1.Color = ButtonBackDarkColor;
                    stop1.Offset = 0.0;

                    GradientStop stop2 = new GradientStop();
                    stop2.Color = ButtonBackLightColor;
                    stop2.Offset = 1.0;

                    GradientStopCollection gsc = new GradientStopCollection();
                    gsc.Add(stop1);
                    gsc.Add(stop2);

                    _buttonGradientBrush = new LinearGradientBrush(gsc, 90.0);
                    _buttonGradientBrush.EndPoint = new Point(0.5, 1);
                    _buttonGradientBrush.StartPoint = new Point(0.5, 0);

                }

                return _buttonGradientBrush;

            }
            set
            {
                _buttonGradientBrush = value;
            }

        }
    }
}
